{template 'common/header'}
<ul class="nav nav-tabs">
	<li><a href="{php echo $this->createWebUrl('goods', array('op'=>'display'));}">商品列表</a></li>
	<li><a href="{php echo $this->createWebUrl('goods', array('op'=>'edit'));}">添加商品</a></li>
	<li class="active"><a href="">购买详细</a></li>
</ul>
<div class="panel panel-danger">
    <div class="panel-heading"></div>
    <div class="panel-body">
        <div class="form-group">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-12 control-label" style="text-align: left;padding-right: 30px;">
           		本期：第（<font color="red">{$period['periods']}</font>）期 - {$goods['title']}
            </label>
             <label class="col-xs-12 col-sm-2 col-md-2 col-lg-12 control-label" style="text-align: left;padding-right: 30px;">
         	   	中奖码：<font color="#64D21A">{$period['code']}</font>
            </label>
   		</div>
    </div>
</div>
{loop $records $record}
<div id="modal-getgoods{$record['id']}" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" style="width:600px;margin:0px auto;">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
				<h3>第(<font color="red">{{$period['periods']}}</font>)期 <{$goods['title']}>商品购买码</h3>
			</div>
			<div class="modal-body">
					{loop $record['code'] $code}
					<span style="margin-left: 2px;">{$code}</span>
					{/loop}
			</div>
			<div class="modal-footer">
				<a href="#" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</a>
			</div>
		</div>
	</div>
</div>
{/loop}
	<div class="panel panel-default">
		<div class="panel-heading">购买详细<a href="javascript:;" onclick="history.go(-1);" style="margin-left: 80%;" class="btn btn-success btn-sm">返回</a></div>
		<div class="panel-body">
			<div class="table-responsive panel-body">
				<table class="table table-hover table-bordered" style="min-width: 300px;">
					<thead class="navbar-inner">
						<tr>
							<th style="width:100px;text-align: center;">商品名称</th>
							<th style="width:180px;text-align: center;">购买人昵称/真实姓名/电话</th>
							<th style="width:60px;text-align: center;">数量</th>
							<th style="width:60px;text-align: center;">总价</th>
							<th style="width:100px;text-align: center;">状态</th>
							<th style="width:160px;text-align: center;">下单时间</th>
							<th style="width:80px;text-align: center;">中奖码</th>
							<th style="width:80px;text-align: center;">操作</th>
						</tr>
					</thead>
					<tbody style="text-align: center;">
						{loop $records $record}
						<tr>
							<td>{$goods['title']}</td>
							<td>{if strpos($record['openid'],'machine') == 'true'}<span style="color: red;">(机器人)</span>{/if}{$record['nickname']}/{$record['realname']}/{$record['mobile']}</td>
							<td>{$record['count']} 个</td>
							<td>{$record['allmoney']} 元</td>
							<td>{if ($record['status']==1)}<span class="label label-info">已支付</span>{else}<span class="label label-default">未支付</span>{/if}</td>
							<td>{php echo date('Y-m-d H:i:s', $record['createtime'])}</td>
							<td>
								{loop $record['code'] $code}
								{if $code==$period['code']}<font color="#64D21A">{$code}</font>{else}{/if}
								{/loop}
							</td>
							<td><span class="label label-info" data-toggle="modal" data-target="#modal-getgoods{$record['id']}">夺宝码</span></td>
						</tr>
						{/loop}
						{if empty($records)}
						<tr>
							<td colspan="8">
								没有交易记录
							</td>
						</tr>
						{/if}
					</tbody>
				</table>
				{$pager}
			</div>
		</div>
	</div>
</div>
<script>
	//获取夺宝码
	function get_codes(codes_id){
		alert("{WELIAM_INDIANA_STATIC}layer/layer.js");
		layer.open({
		  type: 1,
		  skin: 'layui-layer-rim', //加上边框
		  area: ['420px', '240px'], //宽高
		  content: codes_id
		});
	}
</script>
{template 'common/footer'}